<?php

namespace business\company\repositories;

class SupplierProjectRepository
{
    /**
     * 通过时间区间获取供应商ID列表
     * @param string $startDate 开始时间
     * @param string $endDate
     * @return array 供应商ID列表
     */
    public function getSupplierIdsByTimeSlot(string $startDate, string $endDate)
    {
        $connection = \Yii::$app->get('db');
        $sql = "select company_id from `b2b_company`.`uuc_supplier_project` where (`last_modified_time` >= :startDate and `last_modified_time` <= :endDate) or (`audit_time` >= :startDate and `audit_time` <= :endDate) or (`published_time` >= :startDate and `published_time` <= :endDate) group by company_id";
        return $connection->createCommand($sql)
            ->bindValue(':startDate', $startDate)
            ->bindValue(':endDate', $endDate)
            ->queryColumn();
    }
}
